Home |
| Latest | About | Random
# Week 2 Wednesday 6/28 brief notes. Reading: Read 7.1. Finish reading 7.4. Last time we did **partial fractions decomposition** to deal with integration of rational functions, functions of the form $\frac{\text{polynomial}}{\text{polynomial}}$. Such a rational function, after long division, can be broken down into a sum of $\frac{1}{\text{linear}}$ or $\frac{\text{linear}}{\text{quadratic}}$, and if there are repeats, we would need to account for a **staircase** of sum of them (see notes or 7.4). We also use our favorite integral $\int \frac{1}{1+x^2} dx = \arctan(x)+C$ extensively, to deal with irreducible quadratics (after a suitable $u$-subtituion). But there is a slight complication: When doing partial fractions decomposition, what if we have **repeated** irreducible quadratic factors? How do we actually integrate $\int \frac{1}{(1+x^2)^n}dx$ for some positive integer power $n$? Today we will learn a very useful rule called **integration by parts** (7.1) to see how we can deal with this! In short, integration by parts is the "product rule analog to differentiation". It is often useful to (1) deal with an integral involving products, and (2) creating reductive/inductive formulas. Ok! Frist a warm up. **Example.** Find the partial fraction decomposition of the rational function $$ \frac{x^3+1}{(x^2+1)^2} $$Afterwards, try finding an antiderivative of this rational function. $\blacktriangleright$ Note the numerator is degree 3 and the denominator is degree 4, so we do not need to do long division. Since the denominator has two repeated irreducible quadratic factors, we have the general form $$ \frac{x^3+1}{(x^2+1)^2}=\frac{Ax+B}{x^2+1} + \frac{Cx+D}{(x^2+1)^2} $$ Working out the common denominator, we see that the coefficients need to satisfy (from the numerator): $$ x^3+1=(Ax+B)(x^2+1)+Cx+D $$By matching powers of $x$, we get: $$ \begin{matrix} [x^3]: & 1 & = & A \\ [x^2]: & 0 & = & B \\ [x^1]: & 0 & = & A+C \\ [x^0]: & 1 & = & B+D \end{matrix} $$This gives $A=1,B=0,C=-1,D=1$, or $$ \frac{x^3+1}{(x^2+1)^2}=\frac{1}{x^2+1} + \frac{-x+1}{(x^2+1)^2} $$ Now, if we are to integrate this, we see that we have three parts, $$ \int \frac{x^3+1}{(x^2+1)^2}dx=\underbrace{\int \frac{1}{x^2+1}dx}_{(A)}+\underbrace{\int \frac{-x}{(x^2+1)^2}dx}_{(B)} + \underbrace{\int \frac{1}{(x^2+1)^2}dx}_{(C)} $$ Part $(A)$ is just our favorite antiderivative, $\arctan(x)+C$. Part $(B)$ is actually not horrible either, can be done by a simple $u$-substitution: $u=x^2+1$, then $du=2xdx$, so $$ \begin{align*} (B) & =\int \frac{-x}{(x^2+1)^2}dx \\ & =\int \frac{1}{u^2} \frac{du}{2} = \frac{1}{2} \frac{-1}{u} + C \\ & = \frac{-1}{2(x^2+1)}+C \end{align*} $$ But what about part $(C)$? A simple $u$-substitution won't cut it. And what if we get in the general situation $$ \int \frac{1}{(x^2+1)^n} dx= ???? $$ We will address this today. $\blacklozenge$ **Example 2.** Find the antiderivative of $\int \frac{\ln(x)}{x}dx$. How about $\int \ln(x) dx$ ? How about $\int \arctan(x) dx$ ? ## Integration by parts (7.1) Integration by parts is the integral version of product rule from differentiation. Let us start with product rule: $$ \frac{d}{dx}(f(x)g(x))=f'(x)g(x) + f(x)g'(x) $$ So if we integrate both sides, then we get $$ f(x)g(x)=\int f'(x)g(x)dx + \int f(x)g'(x)dx $$ Rearranging gives $$ \int f(x)g'(x)dx= f(x)g(x)-\int f'(x)g(x)dx $$ That is to say, if we want to integrate some product, where one of them is $f(x)$, and the other is some derivative $g'(x)$, we can turn it into **another integral** involving a product but with derivative $f'(x)$ and the original $g(x)$. This trades places with the "derivative" under the integral. Symbolically, I will denote $u=f(x)$ and $v=g(x)$, then note $dv=g'(x)dx$, and $du=f'(x)dx$. So this rule can be rewritten in the following mnemonic: > $$ \int u dv = uv - \int v du $$ So to use integration by parts, we need to identify which part is $u$ and which part is $dv$. Also, if the integral is a **definite integral**, then we also have > $$ \begin{align*} \int_a^b u dv & = uv\bigg|_a^b - \int_a^b v du \\ & = u(b)v(b)-u(a)v(a) - \int_a^b v du \end{align*} $$ Here $uv\bigg|_a^b=u(b)v(b)-u(a)v(a)$. **Example.** Find the antiderivative of $$ \int xe^xdx $$ $\blacktriangleright$ Here the integrand $xe^xdx$ is some $udv$. But which one is $u$ and which one is $dv$? Let us say $u=x$, then $dv = e^x dx$. Then we need to figure out what $du$ and $v$ are. To find $du$ is easy, just differentiate: $du=dx$. To find $v$, we need to integrate $dv$, so $v=\int dv=\int e^xdx=e^x$. (We can worry about $+C$ at the very end) So with $du=dx$ and $v=e^x$, by integration by parts $\int udv=uv-\int vdu$, we get $$ \int x e^x dx = xe^x-\int e^xdx = x e^x-e^x+C. $$ Great! But wait a moment, you ask, what if we have chosen $u=e^x$ and $dv=xdx$? In this scenario, $du=e^xdx$ and $v=\frac{x^2}{2}$. So integration by parts gives $$ \int xe^x dx = e^x \frac{x^2}{2} - \int \frac{x^2}{2}e^xdx. $$This is **correct but not helpful here** -- it seems to have made the expression more complicated, so it doesn't seem to help us resolve the integral further. Though this is the case here, sometimes it is advantageous to "make it more complicated". $\blacklozenge$ ## An integration by parts heuristics : LIATE. In an integral $\int P(x)Q(x)dx$, if our intention is to use integration by parts, $\int udv=uv-\int vdu$, then we need identify $u$ and $dv$, where we then differentiate $u$ to get $du$, and integrate $dv$ to get $v$. So we should: Choose $u$ to be the one that is "easily differentiated", and more importantly, choose $dv$ to be the one that's "easily integrated". This further gives this following heuristics called LIATE, L = Logarithm I = Inverse trigonometric/inverse hyperbolic A = Algebraic (like polynomials, constants) T = Trigonometric functions/hyperbolic E = Exponential It is in the order of "easier to differentiate" to "easier to integrate", so $$ \begin{matrix} & L & I & A & T & E \\ \text{ease of diff.}\leftarrow & u & & & & dv & \rightarrow \text{ease of int.} \end{matrix} $$That is, if it is further to the $L$ side, choose as $u$, and further to the $E$ side, choose as $dv$. **Example.** Find $$ \int x^2 \sin(x)dx $$ $\blacktriangleright$ Using the LIATE heuristics, we will take $u=x^2$ and $\sin(x)dx=dv$. By the way, I usually directly write out what $dv$ is as follows, and directly apply integration by parts: $$ \begin{align*} \int x^2\sin(x)dx & =\int x^2 d (-\cos(x)) \\ & = -x^2\cos(x)-\int(-\cos(x))2xdx \\ & = -x^2\cos(x)+2\int x\cos(x)dx \\ & =-x^2\cos(x)+2\int xd(\sin(x)) \\ & = -x^2\cos(x) + 2\left(x\sin(x)-\int\sin(x)dx\right) \\ & =-x^2\cos(x)+2(x\sin(x)+\cos(x)) + C \\ & = -x^2\cos(x)+2x\sin(x)+2\cos(x)+C. \quad\blacklozenge \end{align*} $$ ## Hidden integration by parts. Sometimes it does not seem like there are two parts in the integrand to perform integration by parts. But there is always a secret factor of $1$. **Example.** Find $$ \int \ln(x)dx $$ $\blacktriangleright$ Here it seems like there is only one term in the integrand, but secretly it is $\ln(x)\cdot 1dx$. So, $$ \begin{align*} \int\underbrace{\ln(x)}_u \underbrace{dx}_{dv} & =x\ln (x)- \int x d (\ln(x)) \\ & =x\ln (x)-\int x\cdot \frac{1}{x}dx \\ & =x\ln(x)-x+C. \quad\blacklozenge \end{align*} $$ **Example.** Find $$ \int \arctan(x)dx $$ $\blacktriangleright$ Again here is an hidden $1dx$. So, $$ \begin{align*} \int \arctan(x)dx & =x\arctan(x) - \int x d(\arctan(x)) \\ & = x\arctan(x)- \underbrace{\int \frac{x}{x^2+1}dx}_{u=x^2+1,du=2xdx} \\ & = x\arctan(x)- \int \frac{du}{2u} \\ & = x\arctan(x) - \frac{1}{2}\ln|u|+C \\ & =x \arctan(x) - \frac{1}{2} \ln|x^2+1| + C. \quad\blacklozenge \end{align*} $$ ## Repeating nature of integration by parts -- Setting a variable for the integral we are solving. Since doing integration by parts is really trading one integral for another, it is possible that we keep trading integrals and it doesn't seem lead to anywhere. But when we recognize an integral that is what we wanted to solve in the first place, we can give it a name and solve for it algebraically. **Example.** Find $$ \int e^x \sin(x)dx $$ $\blacktriangleright$ By the LIATE heuristics, we should set $u=\sin(x)$ and $dv=e^x dx$, so $$ \begin{align*} \int e^x \sin(x) dx & = \int\sin(x)d(e^x) \\ & = e^x \sin(x) - \int e^x d(\sin(x)) \\ & = e^x \sin(x) - \int e^x \cos(x) dx \quad\text{, by parts again}\\ & = e^x \sin(x) - \int \cos(x) d(e^x) \\ & = e^x \sin(x) - \left[e^x\cos(x) - \int e^x d(\cos(x))\right] \\ & = e^x \sin(x) - \left[e^x\cos(x) + \int e^x\sin(x)dx\right] \\ \implies \int e^x \sin(x) dx & = e^x \sin(x) - e^x\cos(x) - \int e^x\sin(x)dx \end{align*} $$ It seems like we ended up where we started! But wait, if we set $I=\int e^x\sin(x)dx$, then we have an algebraic relation $$ I=e^x\sin(x)-e^x\cos(x) - I $$which upon solving for $I$, we get $$ I = \frac{1}{2}(e^x\sin(x)-e^x\cos(x)), $$in other words, $$ \int e^x\sin(x) dx = \frac{1}{2}(e^x\sin(x)-e^x\cos(x)). \quad\blacklozenge $$ ## Reduction / induction formulas. Quite often we can use integration by parts to find reduction / induction formulas for **families of** integrals $I_n$, relating $I_{n+1}$ to $I_n$. And if we know how to do the base case $I_0$ or $I_1$, then we have the whole family! Let us illustrate this. **Example.** Let us find a reduction formula for $$ I_n =\int\sin^n(x)dx $$when $n\ge 2$, an integer. $\blacktriangleright$ Since this is just a bunch of $\sin(x)$ in the integrand, let us take one out to be part of our $dv$. So, $$ \begin{align*} I_n & = \int\sin^n(x)dx \\ & = \int\sin^{n-1}(x) \sin(x)dx \\ & = \int\sin^{n-1}(x) d(-\cos(x)) \\ & = -\cos(x)\sin^{n-1}(x) - \int-\cos(x)d(\sin^{n-1}(x)) \\ & = -\cos(x)\sin^{n-1}(x) +\int\cos(x)(n-1)\sin^{n-2}(x)\cos(x)dx \\ & = -\cos(x)\sin^{n-1}(x)+(n-1)\int\cos^2(x)\sin^{n-2}(x)dx \end{align*} $$ Now, use the fact that $\cos^2(x)=1-\sin^2(x)$, we have,$$ \begin{align*} I_n & = -\cos(x)\sin^{n-1}(x)+(n-1)\int (1-\sin^2(x))\sin^{n-2}(x)dx \\ & = -\cos(x)\sin^{n-1}(x) + (n-1)\left[\int\sin^{n-2}(x)dx-\int\sin^n(x)dx \right] \\ \implies I_n & = -\cos(x)\sin^{n-1}(x)+(n-1)I_{n-2}-(n-1)I_n \end{align*} $$ So if we solve for $I_n$, we get, $$ I_n = \frac{-1}{n}\cos(x)\sin^{n-1}(x)+ \frac{n-1}{n}I_{n-2} $$Alternatively, $$ \int \sin^n(x)dx = \frac{-1}{n}\cos(x)\sin^{n-1}(x)+ \frac{n-1}{n}\int\sin^{n-2}(x)dx $$ And since we know $\int \sin^1(x)dx=-\cos(x)+C$ and $\int\sin^0(x)dx=\int dx=x+C$, we can compute any $I_n = \int \sin^n(x)dx$ for any positive integer $n$. Neat! **Example.** Let us find a reduction/induction formula for $$ I_n = \int \frac{1}{(x^2+1)^n}dx $$This will let us deal with those pesky terms that show up in more complicated partial fraction decompositions. $\blacktriangleright$ Here, we use $dv=1\cdot dx$, the hidden factor. So, $$ \begin{align*} I_n & = \int \frac{1}{(x^2 + 1)^n}dx \\ & = \frac{x}{(x^2+1)^n} - \int x d\left( \frac{1}{(x^2+1)^n} \right) \\ & = \frac{x}{(x^2+1)^n} + 2n \int \frac{x^2}{(x^2+1)^{n+1}} dx \quad\text{now add and subtract trick}\\ & = \frac{x}{(x^2 + 1)^n} + 2n\int \frac{x^2+1-1}{(x^2+1)^{n+1}}dx \\ & =\frac{x}{(x^2+1)^n} + 2n \left[\int \frac{x^2+1}{(x^2+1)^{n+1}}dx -\int \frac{1}{(x^2+1)^{n+1}}\right] \\ \implies I_n & = \frac{x}{(x^2+1)^n} + 2nI_n - 2nI_{n+1} \end{align*} $$which upon solving for $I_{n+1}$, we get $$ I_{n+1} = \frac{1}{2n}\frac{x}{(x^2+1)^n} + \frac{2n-1}{2n}I_n $$In other words, $$ \int \frac{1}{(x^2+1)^{n+1}}dx= \frac{1}{2n} \frac{x}{(x^2+1)^n} + \frac{2n-1}{2n} \int \frac{1}{(x^2+1)^n}dx $$ In particular, $$ \begin{align*} \int \frac{1}{(x^2+1)^2}dx & = \frac{1}{2} \frac{x}{x^2+1} + \frac{1}{2} \int \frac{1}{x^2+1}dx \\ & = \frac{x}{2(x^2+1)} + \frac{1}{2}\arctan(x)+C. \end{align*} $$ Amazing ! $\blacklozenge$ ///